package org.example.logistic.controller;


import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.entity.UserAddresses;
import org.example.logistic.service.UserAddressesService;
import org.example.result.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户地址信息表 前端控制器
 * </p>
 *
 * @author fanfutian
 * @since 2025-05-20
 */
@Slf4j
@RestController
@RequestMapping("/logistic")
@RequiredArgsConstructor
public class UserAddressesController {

    private final UserAddressesService userAddressesService;

    @GetMapping("/getAddresses")
    public Result<List<UserAddresses>> getUserAddresses(@RequestParam Long userId){
        log.info("查询用户地址信息");
        List<UserAddresses> userAddresses = userAddressesService.getAddressesByUserId(userId);
        return Result.success(userAddresses);
    }


}
